package net.lovesrc.support.service.generator.bankcard;

/**
 * <pre>
 * 银行卡类型枚举类
 * Created by Binary Wang on 2017-3-31.
 * @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
 * </pre>
 */
public enum BankCardTypeEnum {
    /**
     * 借记卡/储蓄卡
     */
    DEBIT("借记卡/储蓄卡", "DC"),
    /**
     * 信用卡/贷记卡
     */
    CREDIT("信用卡/贷记卡", "CC");

    private final String title;
    private final String sname;

    BankCardTypeEnum(String title, String sname) {
        this.title = title;
        this.sname = sname;
    }

    public String getTitle() {
        return title;
    }

    public String getSname() {
        return sname;
    }

    public static BankCardTypeEnum parseBySname(String sname) {
        BankCardTypeEnum[] values = values();
        for (BankCardTypeEnum value : values) {
            if (value.getSname().equals(sname)) {
                return value;
            }
        }
        return null;
    }
}
